<template>
    <div>
      
        

        
           
            <el-table
                :data="fetchData"
                border
                class="table"
                ref="BorrowingData"
                header-cell-class-name="table-header"
                @selection-change="handleSelectionChange"
            >       
          


                  <el-table-column label="基础信息"  width="800" style="text-a" border >
                            <el-table-column type="selection"  align="center"></el-table-column>
                            <el-table-column prop="id" label="ID"  align="center"></el-table-column>
                            <el-table-column prop="addr" label="地址"  width="200"></el-table-column>
                            <el-table-column prop="area"   label="实际面积(㎡)"  width="100"></el-table-column>
                            <el-table-column prop="card_area"   label="证上面积(㎡)" width="100"></el-table-column>
                            <el-table-column prop="land_no"   label="房产证号"  width="230"></el-table-column>
                            <el-table-column prop="type"   label="资产特征"  width="100"></el-table-column>
                  </el-table-column>
                   <el-table-column label="使用情况" border>
                            <el-table-column prop="ziyin_area"   label="自用面积(㎡)"  width="100"></el-table-column>
                            <el-table-column prop="zulin_area"   label="租赁面积(㎡)"  width="100"></el-table-column>
                            <el-table-column prop="xianzhi_area"   label="闲置面积(㎡)"  width="100"></el-table-column>
                            <el-table-column prop="qt"   label="其它(㎡)"></el-table-column>
                  </el-table-column>
                   <el-table-column label="拆迁信息">
                             <el-table-column prop="reset_type"   label="安置类型"></el-table-column>
                            <el-table-column prop="reset_price"   label="安置费用"></el-table-column>
                            <el-table-column prop="transe_fee"   label="过渡费用"></el-table-column>
                            <el-table-column prop="reset_area"   label="就地安置面积"  width="110"></el-table-column>
                            <el-table-column prop="reset_yarea"   label="异地安置面积"  width="110"></el-table-column>
                            <el-table-column prop="sspfwh"   label="市社批复文号"  width="110"></el-table-column>
                  </el-table-column>
                
                
               
            
                <el-table-column label="合同情况" width="120" align="center"   fixed="right" >
                    <template slot-scope="scope">
                               <el-button
                            type="text"
                            icon="el-icon-lx-text"
                           
                            @click="handleEdit(scope.$index, scope.row,'select')"
                        >查看</el-button>
                        <el-button
                            type="text"
                            icon="el-icon-edit"
                            @click="handleEdit(scope.$index, scope.row,'edit')"
                        >编辑</el-button>
                        
                        

                    </template>
                </el-table-column>
            </el-table>
         
        

        <!-- 编辑弹出框 -->
          <el-dialog :title="detailTitle" :visible.sync="editVisible" width="60%">

                <div class="box1" label-width="70px">

                        <div class="li">
                            <span>出租方</span>
                            <el-input class="put" v-model="name" placeholder="请输入内容" clearable></el-input>
                        </div>
                          <div class="li">
                            <span>出租资产</span>
                            <el-input class="put" v-model="name" placeholder="请输入内容" clearable></el-input>
                        </div>
                          <div class="li">
                            <span>承租方</span>
                            <el-input class="put" v-model="name" placeholder="请输入内容" clearable></el-input>
                        </div>
                          <div class="li">
                            <span>合同编号</span>
                            <el-input class="put" v-model="name" placeholder="请输入内容" clearable></el-input>
                        </div>
                          <div class="li">
                            <span>租赁面积</span>
                            <el-input class="put" v-model="name" placeholder="请输入内容" clearable></el-input>
                        </div>
                          <div class="li">
                            <span>租赁面积</span>
                            <el-input class="put" v-model="name" placeholder="请输入内容" clearable></el-input>
                        </div>
                          <div class="li">
                            <span>合同金额</span>
                            <el-input class="put" v-model="name" placeholder="请输入内容" clearable></el-input>
                        </div>
                          <div class="li">
                            <span>合同图片</span>
                            <el-input class="put" v-model="name" placeholder="请输入内容" clearable></el-input>
                        </div>
                         <div class="li">
                            <span>设置提醒</span>
                            <el-input class="put" v-model="name" placeholder="请输入内容" clearable></el-input>
                        </div>
                </div>
          
            <span slot="footer" class="dialog-footer">
                <el-button @click="editVisible = false">重置</el-button>
                <el-button type="primary" @click="saveEdit">立即提交</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script>


export default {
    name: 'basetable',
    data() {
        return {
             activeName: 'first',
            query: {
                address: '',
                name: '',
                pageIndex: 1,
                pageSize: 10
            },
            multipleSelection: [],
            delList: [],
            editVisible: false,
            pageTotal: 0,
            form: {},
            idx: -1,
            id: -1,
            name:'',
            detailTitle:'',

        };
    },
    props:["fetchData"],
    created() {
        
       console.log("tableData",this.fetchData)
    },
    methods: {
         handleClick(tab, event) {
          console.log(tab, event);
         },
        // 获取 easy-mock 的模拟数据
        
        // 触发搜索按钮
        handleSearch() {
            this.$set(this.query, 'pageIndex', 1);
           // this.getData();
        },
        // 删除操作
        handleDelete(index, row) {
            // 二次确认删除
            this.$confirm('确定要删除吗？', '提示', {
                type: 'warning'
            })
                .then(() => {
                    this.$message.success('删除成功');
                    this.tableData.splice(index, 1);
                })
                .catch(() => {});
        },
        // 多选操作
        handleSelectionChange(val) {
            this.multipleSelection = val;
        },
        handleSelect(){

        },
        delAllSelection() {
            const length = this.multipleSelection.length;
            let str = '';
            this.delList = this.delList.concat(this.multipleSelection);
            for (let i = 0; i < length; i++) {
                str += this.multipleSelection[i].name + ' ';
            }
            this.$message.error(`删除了${str}`);
            this.multipleSelection = [];
        },
       // 编辑操作
        handleEdit(index, row,type) {
            this.detailTitle=type=='select'?'查看合同详情':'编辑合同'
            this.idx = index;
            this.form = row;
            this.editVisible = true;
        },
        // 保存编辑
        saveEdit() {
            this.editVisible = false;
            this.$message.success(`修改第 ${this.idx + 1} 行成功`);
            this.$set(this.tableData, this.idx, this.form);
        },
        // 分页导航
        handlePageChange(val) {
            this.$set(this.query, 'pageIndex', val);
           // this.getData();
        }
    }
};
</script>

<style scoped lang="less">
.handle-box {
    margin-bottom: 20px;
}

.handle-select {
    width: 120px;
}

.handle-input {
    width: 300px;
    display: inline-block;
}
.table {
    width: 100%;
    font-size: 14px;
}
.red {
    color: #ff0000;
}
.mr10 {
    margin-right: 10px;
}
.table-td-thumb {
    display: block;
    margin: auto;
    width: 40px;
    height: 40px;
}

/deep/ .cell{
    font-size: 12px;
}
/deep/ th{
    text-align: center;
}
.box1{
    .li{
        display: flex;
            align-items: center;
            margin-bottom: 10px;
        span{
            text-align: right;
            width: 70px;
            font-size: 15px;
            font-weight:bold;
          padding-right: 30px;
        }
        .put{
            width: 300px;
        }
    }
}

// /deep/ .el-table--small td, .el-table--small th{
//     padding: 10px;
// }
</style>
